<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:s="http://jboss.com/products/seam/taglib">

<ui:composition template="/content/templates/adminTemplate.xhtml">
    <ui:param name="selectedMenuSub1" value="users"/>
    <ui:param name="userRole" value="#{adminBean.role}"/>
    <ui:define name="title">#{labels['USERS']}</ui:define>
    <ui:decorate template="/content/templates/contentDecorator.xhtml">

        <h:form>
            <h:panelGroup rendered="#{adminBean.users.size() gt 0}">
                <h:dataTable value="#{adminBean.users}" var="user"
                             style="margin:0 auto 0 auto;" styleClass="fullWide" rowClasses="odd, even" headerClass="header">
                    <h:column>
                        <f:facet name="header">
                            #{labels['LOGIN']}
                        </f:facet>
                        #{user.login}
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            #{labels['EMAIL']}
                        </f:facet>
                        #{user.userInfo.email}
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            #{labels['ROLE']}
                        </f:facet>
                        <h:selectOneMenu value="#{user.role}" styleClass="mediumd">
                            <c:forEach items="#{userRoles}" var="role">
                                <s:enumItem enumValue="#{role}" itemLabel="#{labels[role.name()]}"/>
                            </c:forEach>
                        </h:selectOneMenu>
                    </h:column>
                </h:dataTable>
                <div style="padding-top:20px;" class="rj">
                    <h:commandButton value="#{labels['READY']}" action="#{adminBean.updateUserRoles}"/>
                </div>
            </h:panelGroup>
        </h:form>

    </ui:decorate>
</ui:composition>
</html>